import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class TopSearchWidget extends StatefulWidget {
  final show;

  TopSearchWidget({this.show});

  @override
  State<StatefulWidget> createState() {
    return _TopSearchWidgetState();
  }
}

class _TopSearchWidgetState extends State<TopSearchWidget> {
  @override
  Widget build(BuildContext context) {
    if (widget.show) {
      return Material(
        elevation: 20.h,
        child: Container(
          height: 220.h,
          color: Colors.white,
          child: Padding(
            padding: EdgeInsets.only(top: 60.h),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Container(
                  margin: EdgeInsets.only(left: 40.h),
                  height: 120.h,
                  width: 800.w,
                  child: InkWell(
                    onTap: _search,
                    child: Card(
                      elevation: 10.h,
                      child: Row(
                        children: <Widget>[
                          SizedBox(
                            width: 20.w,
                          ),
                          Icon(
                            Icons.search,
                          ),
                          SizedBox(
                            width: 20.w,
                          ),
                          Text(
                            "搜寻你的心水楼盘",
                          )
                        ],
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      );
    } else {
      return Container();
    }
  }

  void _search() {
    print("search");
  }

  void _person() {
    print("person");
  }
}
